<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document-admin</title>
</head>
<!-- 引入样式 -->
<link rel="stylesheet" href="../../plugins/element-ui/lib/theme-chalk/index.css"/>
<!--<link rel="stylesheet" href="../../styles/common.css" />-->
<link rel="stylesheet" href="../../styles/page.css" />
<body>
<div class="dashboard-container" id="admin-app">
    <div class="tableBar">
        渠道编号：{{id}}   渠道：{{channel.name}}
<!--        <el-button type="primary" @click="outputStud()">-->
<!--            导出班级学生情况-->
<!--        </el-button>-->
    </div>
    <div class="container">
        <!--管理员分页展示table-->
        <el-table :data="tableData" stripe class="tableBox">
            <el-table-column prop="name" label="学生姓名"></el-table-column>
            <el-table-column prop="sid" label="学号"></el-table-column>
            <el-table-column prop="school" label="学校"></el-table-column>
            <el-table-column prop="major" label="专业"></el-table-column>
            <el-table-column prop="grade" label="入学年份"></el-table-column>
            <el-table-column prop="clazzName" label="班级名"></el-table-column>
            <el-table-column prop="status" label="状态"></el-table-column>
            <el-table-column prop="gone" label="去向"></el-table-column>
        </el-table>
    </div>
</div>
</body>
<!-- 开发环境版本，包含了有帮助的命令行警告 -->
<script src="../../plugins/vue/vue.js"></script>
<!-- 引入组件库 -->
<script src="../../plugins/element-ui/lib/index.js"></script>
<!-- 引入axios -->
<script src="../../plugins/axios/axios.min.js"></script>
<script src="../../js/request.js"></script>
<script src="../../js/validate.js"></script>
<script src="../../api/channel.js"></script>
<script src="../../js/index.js"></script>
<script>
    new Vue({
        el: '#admin-app',
        data() {
            return {
                input: '',
                tableData : [],
                id : '',
                channel:{
                },
                status : '',
            }
        },
        computed: {},

        created() {
            this.id = requestUrlParam('id');//从网址上解析参数
            if (this.id) {
                this.init()
            }
        },
        mounted() {
        },
        methods: {
            async init () {
                await queryStudentByChannelById(this.id).then(res => {//res === res.data
                    if (String(res.code) === '1') {
                        this.tableData = res.data
                    }
                }).catch(err => {
                    this.$message.error('请求出错了：' + err)
                })
                await queryChannelById(this.id).then(res => {//res === res.data
                    if (String(res.code) === '1') {
                        this.channel = res.data
                    }
                }).catch(err => {
                    this.$message.error('请求出错了：' + err)
                })

            },
            handleQuery() {
                this.page = 1;
                this.init();
            },
            handleSizeChange (val) {
                this.pageSize = val;
                this.init()
            },
            handleCurrentChange (val) {
                this.page = val;
                this.init()
            }
        }
    })
</script>
</html>